


function buildRel(btn,entity2,fn_id,fns){
	var grid = btn.up('bat_grid');
	var ui=grid.ui;
	 var ui1=ui.ui1;
	 if(!ui1)
	 	return;
	 var sels=grid.getSelectionModel().getSelection();
	if(!sels) return;
	 var tobjs = ui1.objs;
	 var robj = ui1.robj;
	 var entity1,kv1;
	
	 entity1 = robj.cns[0];	

	 var kn = 'id';
	//考虑到中英文表的情况
	 kv1 = robj.items.map[kn]||robj.items.map['A.'+kn];
	 var dobj = tobjs[0];
	 var appendObjs=[];
	for(var i=0; i<sels.length; i++){
		var tobj = Bat.clone(dobj);
		tobj.action='A';
		var o = sels[i].obj;
		o.action = "R";
		tobj.items.map['A.entity1']=entity1 ;
		tobj.items.map['A.id1']=kv1;
		tobj.items.map['A.entity2']=entity2;
		tobj.items.map['A.id2']=o.items.map[fn_id];
		tobj.items.map['A.ord']=tobjs.length-1;
		for(var j=0; j<fns.length; j++){
			var fn = fns[j];
			var pos = fn.indexOf('.');
			var fno = (pos==-1)?fn:fn.substring(pos+1);
			//由于关联视图保存时,从对象没有id,不保存,增加一些属性不会出问题
			tobj.items.map['B.'+fno]=o.items.map[fn];
		}
		tobjs[tobjs.length]=tobj;
		appendObjs[appendObjs.length]=tobj;
	}
	
	ui.reload = false;
	ui.ds.load();
	if(ui1.grid.renderfunc){
		ui1.grid.renderfunc(ui1.grid.body,ui1,appendObjs);
	}else{
		ui1.reload = false;
		ui1.ds.load();
		//ui1.grid.getSelectionModel().selectLastRow();
	}
}


BView.btns={
	"json_cls":	{text:'json',
		cls: 'x-btn-text-icon',
		menu:{items:[{
	   		text: '导出',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/disk.png',
			handler : function(btn){
		var robj = btn.ui.robj;
		   Ext.MessageBox.wait({
	           title: 'Please wait',
	           msg: 'Loading items...'
	       });
	       var im = robj.items.map;
		  var req={"map":{nid:im.id},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
	   		//Ext.MessageBox.hide();
	   		//var fn = im.id  +"_cls_"+im.language+".json";
	   		//var jwin = window.open("../servlet/fu?f="+im.uid+"\\json\\"+fn);
		  },'S',req,'RMService');            	
 		
	}},{
	text: '导入',
    cls: 'x-btn-text-icon',
    icon: 'icons/add.png',
	handler : function(btn){
		//TODO
	}				
	}]}},
	"json":	{text:'json',
		cls: 'x-btn-text-icon',
		menu:{items:[{
	   		text: '导出内容',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/disk.png',
			handler : function(btn){
			  var filter;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
		        Ext.MessageBox.show({
		           title: '系统提示',
		           msg: '请先选中一条记录',
		           buttons: Ext.MessageBox.OK,
		           icon: Ext.MessageBox.INFO
		       });
			  	return;
			  }
			var selmap = sels[0].obj.items.map;
			filter = "from NBase where id="+selmap.id;
		   Ext.MessageBox.show({
	           title: 'Please wait...',
	           msg: 'Loading items...',
	           progressText: 'Initializing...',
	           width:300,
	           progress:true,
	           closable:true
	           //animEl: 'mb6'
	       });
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,filter:filter,bcover:false},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
		  },'J',req,'RMService');            	

   			
   		},'N',req,'TaskHandle');            	
		
	}},{
	text: '导出封面',
    cls: 'x-btn-text-icon',
    icon: 'icons/add.png',
	handler : function(btn){
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,bcover:true},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
		  },'J',req,'RMService');            	

   			
   		},'N',req,'TaskHandle');            	
	}				
	}]}},
	
 "copyto":{
	text: Bat.info.mnu_copyto_title,
    cls: 'x-btn-text-icon',
    icon: 'icons/disk_multiple.png',
	handler : function(btn){		
      var ui=btn.ui;
	  var sels=btn.ui.grid.getSelectionModel().getSelections();
	  var bsel = sels && sels.length>0;
	  if(!bsel){
	  	return;
	  }
	  var title = (bsel?Bat.info.mnu_copyto_sel:Bat.info.mnu_copyto_flt)+Bat.info.mnu_copyto_title;
		Ext.Msg.prompt(title,Bat.info.mnu_copyto_rtid, function(btn, text){
		   if (btn == 'ok'){
		        // process text value and close...
		   	var ids=[];
		   	var rtid=text;
	  		for(var i=0; i<sels.length; i++){
	  			var im = sels[i].obj.items.map;
	  			ids[ids.length]=im.id;
	  		}

		   Ext.MessageBox.show({
	           title: 'Please wait',
	           msg: 'Loading items...',
	           progressText: 'Initializing...',
	           width:300,
	           progress:true,
	           closable:true
	           //animEl: 'mb6'
	       });
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,ids:ids,rtid:rtid},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'复制菜单异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
	   		Ext.MessageBox.hide();
		  },'C',req,'RMService');            	
   		},'N',req,'TaskHandle');            		  			  		
		   }
		});
}}
}

BView.viewMap={
"dao.hb.UOrg":{
	  req:{
		  "pss":[["oid","version","name","pid","id","ord","status","dtCreate","dtModify","uid"]],
		  "cns":["dao.hb.UOrg"],
		  "hql":"from UOrg"
	  },
	
	  cfg_prop:{
		  "oid":{
			  display:"机构编号"
		  },
		  "version":{
			  display:"版本"
		  },
		  "name":{
			  display:"名称"
		  },
		  "pid":{
			  display:"上机机构"
		  },
		  "id":{
			  display:"编号"
		  },
		  "ord":{
			  display:"排序"
		  },
		  "status":{
			  display:"状态"
		  },
		  "dtCreate":{
			  editor:"DateField",
			  display:'建立时间'
		  },
		  "dtModify":{
			  editor:"DateField",
			  display:'修改时间'
		  },
		  "uid":{
			  display:"创建人编号"
		  }
	  }
	  ,cfg_detail:{
			btns:["保存"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["oid","version","name","pid","id","ord","status","dtCreate","dtModify","uid"]
				}]
				}]},
			cfg_grid:{
				btns:['增加','删除','打开','保存','检索','刷新','排序']
			}
  },	
"rel_user":{
	req:{
		"pss" : [["id","entity1", "id1","entity2","id2","ord","dtCreate"],['name','avatar']],
		"cns" : ["dao.hb.RRel","dao.hb.UUser"],
		"hql" : "from RRel A, UUser B where A.entity2='dao.hb.UUser' and A.id2=B.id order by A.ord"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_grid:{
		btns:['删除','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"A.id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"A.id1":{
	 	display:"id1",
	 	hidden:true
	},
	"A.id2":{
	 	display:"id2",
	 	hidden:true
	},
	"A.ord":{
	 	display:"顺序"
	},
	"A.entity1":{
	 	display:"entity1",
	 	hidden:true
	},
	"A.entity2":{
	 	display:"entity2",
	 	hidden:true
	},
	"B.name":{
	 display:"用户名"
	},	
	"B.avatar":{
	  display:'用户头像',
	  	cfg:{readOnly:true},
	  	editor:'DisplayField',
	  	renderer : function(itxt,r,col,l) {	
	  		var src=itxt?"/ipcm/servlet/fu?f="+itxt:'icons/avatar.png';
	  		var its = r.record?r.record.data:r.item||{};
	  		return "<img style='cursor:hand;' src='"+src+"' title='"+ its['B.name']
	  		+"' onclick='layout.renderDetailByKey(\"dao.hb.UUser\",false,"+its['A.id2']+");return false;'/>";
		}
	 },
	 "pid":{
	 display:"父节点"
	},"A.dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
		readOnly:true
	 	}  
	 }
	}
 },	
	
 "dao.hb.PProject":{
 	cn:'项目',
	req:{
		"pss" : [["id","uid", "aid","stype", "name","keyname","status","dtDue","dtCreate","dtModify","summery"]],
		"cns" : ["dao.hb.PProject"],
		"hql" : "from PProject"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid", "aid","stype", "name","keyname","status","dtDue","dtCreate","dtModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["summery"]
		}]
	}]},
	cfg_grid:{
		selType:'cellmodel',
		btns:['增加','删除','打开','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"aid":{
		 display:"负责人",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"uid":{
		 display:"录入",
		 editor : 'ComboBox',
		  dcfg:{
			readOnly:true
		 },
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
		width:90,
	 	display:"阶段",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['需求调研', '需求调研'], ['设计', '设计'], ['编码', '编码'], ['测试', '测试'],['部署', '部署'],['完成', '完成']])
	},
	"dtDue":{
	  editor:"DateField",
	  display:'交付时间'
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  cfg:{
	  	readOnly:true
	  }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
	  	readOnly:true
	  }
	},"summery":{
	  display:'备注',
	  editor:"TextArea"
	},"keyname":{
	  display:'代号'
	},"name":{
	  display:'名称'
	},
	"stype":{
	 	display:"分类",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['外包', '外包'], ['外派', '外派'], ['预研', '预研'], ['合同', '合同']])
	}
  },child_views : [{
  	title:"项目任务",
  	vn:"dao.hb.PTask",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from PTask where pid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.PProject";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }],
     rel_views:[{
  	title:"项目人员",
  	vt:{
  		title:"已选人员",
		vn : 'rel_user',
		func_filter : function(robj, ui) {
			var hql = " from RRel A , UUser B where B.id=A.id2 and A.entity1='dao.hb.PProject' and A.entity2='dao.hb.UUser' and A.id1="
					+ (robj.items.map['id']||robj.items.map['A.id']||0) +" order by A.ord";
			ui.setHQL(hql);
		},
    	func_view :function(vw){
      		var btns=['打开','增加', '删除', '保存'];
     	}
  	},
  	vs:{
  		vn:"dao.hb.UUser",
  		title:"可选人员",
  		func_filter : function(robj, ui) {
			//var hql = "from dao.hb.UUser order by id desc  ";
			var hql="from UUser  where id not in ( select id2 from RRel where entity1='dao.hb.PProject' and entity2='dao.hb.UUser' and id1="+(robj.items.map['id'] || 0)+") ";
			ui.setHQL(hql);
		},
		func_view :function(vw){
			vw.cfg_grid.btns=['检索','刷新','排序',{
		   		text: '添加人员',
		   		iconCls: 'plugin_add',
				handler : function(btn){
			    	buildRel(btn,'dao.hb.UUser','id',['name',"avatar"]);
			    }
			 }];
		}

  	}
  }]
 
 },	
 "dao.hb.PTask":{
  	handles:{'before_setobj_detail':function(ui,editors,obj){
  		//editors['dtResolved'][0].setReadOnly(false);
/*  		if(layout.uid==obj.items.map['uid'])
  			BView.setEnableFields(editors,['id','status','resolved'],false);
  		else
  			BView.setEnableFields(editors,['status','resolved'],true);
*/     }
  	},
 	cn:'任务',
	req:{
		"pss" : [["id","uid", "pid","cid","tid","aid","stype", "name","priority","status","resolved","dtDue","dtCreate","dtModify","dtResolved","summery"]],
		"cns" : ["dao.hb.PTask"],
		"hql" : "from PTask"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid", "pid","cid","tid","aid","stype", "name","priority","status","resolved","dtDue","dtCreate","dtModify","dtResolved"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["summery"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"dtDue":{
	  editor:"DateField",
	  display:'交付时间'
	},
	"uid":{
		 display:"录入",
		 editor : 'ComboBox',
		  dcfg:{
			readOnly:true
		 },
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"priority":{
	 	display:"优先级",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['Blocker', 'Blocker'], ['Critical', 'Critical'], ['Major', 'Major'], ['Minor', 'Minor'], ['Trivial', 'Trivial']])
	},
	"stype":{
	 	display:"分类",
		editor : 'ComboBox',
		width:80,
		cfg :BView.func_cfg_combo([['新任务', '新任务'],['新功能', '新功能'],['建议', '建议'], ['测试bug', '测试bug'], ['功能增强', '功能增强']])
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"aid":{
		 display:"负责人",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id",
		 {
		 	listeners: {
		 		'beforequery':{
		 			fn:function(queryPlan, eOpts){
		 				var cbo =queryPlan.combo; 
		 				//var ourl=cbo.store.proxy.url;
		 				var	baseurl = CFG.app_ctx+"servlet/JSonBaseServlet?hql=";
		 				cbo.store.proxy.url = baseurl+"select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser' and B.id1="
		 					+cbo.item['pid']+"  order by B.ord";
		 				cbo.store.load();
		 				//cbo.store.proxy.url=ourl;
		 			}
		 		}
		 	}
		 }
		 )
	},"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['打开','打开'],['处理中','处理中'],['重新打开','重新打开'],['已解决','已解决'],['关闭','关闭'],['暂缓','暂缓'], ['拒绝', '拒绝']])
	},"resolved":{
	 display:"处理结果",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['完成修改', '完成修改'], ['无法修改', '无法修改'], ['重复问题', '重复问题'], ['描述不清', '描述不清']
		, ['无法重现', '无法重现'], ['部分修改', '部分修改'], ['测试完成', '测试完成'], ['测试未完成', '测试未完成'], ['暂停', '暂停']])
	},"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"dtResolved":{
	  editor:"DateField",
	  display:'解决时间',
	  dcfg:{
		readOnly:true
	 }
	},"summery":{
	  display:'备注',
	  editor:"TA",
	  cfg:{
	  	menuHeight:150,
	  	menuWidth:300,
	  	func_insert:function(data){
	  		return data['name'];
	  	},
	  	func_filterBy:function(rd,str){
			return rd.get('pyh').indexOf(str)==0;
		},
		ds:{
	        fields: ['name','pyh','org'],
	        proxy: {
	           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
	            type: 'ajax',
	            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql='+'select A.name,A.namePyh,B.name from UUser A,UOrg B where A.oid=B.id',
	            
	            reader: {
	                type: 'array',
	                root: 'list'
	            }
	        },
	        autoLoad: true
	    },
	  columns: [
	        { text: 'name', dataIndex: 'name'},
	        { text: 'pyh', dataIndex: 'pyh' },
	        { text: 'org', dataIndex: 'org' }
	    ]
	}	
	},"name":{
	  display:'名称',
	  width:150
	}
  },child_views : [{
  	title:"子任务",
  	vn:"dao.hb.PTask",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from PTask where tid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["tid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.PProject";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }]
 },	
		
 "dao.hb.OAttach":{
	req:{
		"pss" : [["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify","remark"]],
		"cns" : ["dao.hb.OAttachment"],
		"hql" : "from OAttachment"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序',{
	   		text: '比对',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/connect.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
	  	layout.showTabPicc();
        var dh = Ext.DomHelper;
        var ct_picc = Ext.getDom("tabs_picc");
        var pos_left=0;
        var pos_top = 0;
  		for(var i=0; i<sels.length; i++){
			var src = BView.get_attach_url(sels[i].obj.items.map.path);
        	layout.addtp(src);
			}
		}}],
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0]])
	},
	"entityName":{
	 display:'数据库表',
	 	  cfg:{
	  	readOnly:true
	 },
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"entityId":{
	 display:"记录编号"
	},
	"name":{
	 display:"附件名"
	},
	"stype":{
	 display:"附件分类"
	},
	"size":{
	 display:"文件长度"
	},
	"path":{
		display:'附件路径',
		editor:"FileField"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  }
 },	
	

 "dao.hb.NSort":{
	req:{
		"pss" : [["id","nid", "uid","title","pid","dtCreate"]],
		"cns" : ["dao.hb.NSort"],
		"hql" : "from NSort"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"pid":{
	 display:"父节点"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
		readOnly:true
	 	}  
	 }
	}
 },


"dao.hb.NImage":{
	req:{
		"pss" : [["id","nid", "uid","title","detail","width","height","fsize","uri","dtCreate"]],
		"cns" : ["dao.hb.NImage"],
		"hql" : "from NImage"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"detail":{
	 display:"描述"
	},
	"width":{
	 display:"宽度"
	},
	"height":{
	 display:"高度"
	},
	"fsize":{
	 display:"文件尺寸"
	},
	"uri":{
	 display:"路径",
	 editor:"FileField"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 }
	}
 },
 
 "dao.hb.NMenu":{
	req:{
		"pss" : [["id","nid", "uid","title","status","stype","price","priceUnit","runtime","summery","style","uriMedia","dtCreate","dtModify"]],
		"cns" : ["dao.hb.NMenu"],
		"hql" : "from NMenu"
	},
	cfg_grid:{
		hide: ["summery","style"]
	},
	cfg_detail:{
		btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","nid", "uid","title","status","stype","price","priceUnit","runtime","uriMedia","dtCreate","dtModify"]
		}]
		},{
			title : "简介",
			fset : [{
				legend : "",
				props :["summery"]
			}]
		},{
			title : "可选做法",
			fset : [{
				legend : "",
				props :["style"]
			}]
		}]
	},	
	cfg_prop:{
	"price":{
	 display:"价格"
	},
	"priceUnit":{
	 display:"价格单位"
	},
	"runtime":{
	 display:"做菜时长"
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},
	"uriMedia":{
	 display:"音视频"
	},
	"style":{
	 display:"可选做法",
	 editor:"TextArea"
	},
	"status":BView.cfg_status,
	"stype":{
	 display:"分类"
	},
	"summery":{
	 display:"简介",
	 editor:"TextArea"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最近修改',
	  dcfg:{
		readOnly:true
	 	}  
	 }

	}
 }, 
 "dao.hb.NRestaurant":{
 	//Integer nid, Integer uid, Integer rid, String title, Integer status, String stype, String city, Float longitude, Float latitude, Integer outgoing, String summery, String homepage, String contact, String descTicket, String descOpen, String descTraffic, String uriMedia, Date dtCreate, Date dtModify
	req:{
		"pss" : [["id","nid", "uid","title","status","outgoing","stype","city","longitude","latitude","summery","homepage","contact","descTicket","descOpen","descTraffic","dtCreate","dtModify"]],
		"cns" : ["dao.hb.NRestaurant"],
		"hql" : "from NRestaurant"
	},
	cfg_grid:{
		hide: ["summery","contact","descTicket","descOpen","descTraffic"]
	},
	cfg_detail:{
		btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","nid", "uid","title","stype","city","longitude","latitude","outgoing","dtCreate"]
		}]
		},{
			title : "简介",
			fset : [{
				legend : "",
				props :["summery"]
			}]
		},{
		title : "联系方式",
		fset : [{
			legend : "",
			props :["contact"]
		}]
		},{
			title : "票务信息",
			fset : [{
				legend : "",
				props :["descTicket"]
			}]
		},{
			title : "营业",
			fset : [{
				legend : "",
				props :["descOpen"]
			}]
		},{
			title : "交通路线",
			fset : [{
				legend : "",
				props :["descTraffic"]
			}]
		}]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"stype":{
	 display:"分类",
		editor:"TreeCombo",
		cfg:{
			sepperator:';',
	        width: 400,
	        listWidth:320,
	        lazyInit:false,
			store: new Ext.data.TreeStore({
                proxy: {
                    type: 'ajax',
                    url: 'class_restaurant.json'
                },
                sorters: [{
                    property: 'leaf',
                    direction: 'ASC'
                }, {
                    property: 'text',
                    direction: 'ASC'
                }]
            })
		}
	},
	"city":{
	 display:"城市",
		editor:"TreeCombo",
		cfg:{
           singleSelect:true,
			isExpanded:false,
	        width: 400,
	        listWidth:320,
	        lazyInit:true,
			store: new Ext.data.TreeStore({
                proxy: {
                    type: 'ajax',
                    url: 'citys.json'
                },
                sorters: [{
                    property: 'leaf',
                    direction: 'ASC'
                }, {
                    property: 'text',
                    direction: 'ASC'
                }]
            })
		}
	},
	"longitude":{
	 display:"经度"
	},
	"latitude":{
	 display:"纬度"
	},
	"summery":{
	 display:"简介",
	 editor:"TextArea"
	},
	"homepage":{
	 display:"网站主页"
	},
	"contact":{
	 display:"联系方式",
	 editor:"TextArea"
	},
	"descTicket":{
	 display:"最低消费",
	 editor:"TextArea"
	},
	"outgoing":{
	 display:"送餐范围"
	},
	"descOpen":{
	 display:"开放时间",
	 editor:"TextArea"
	},
	"descTraffic":{
	 display:"交通线路",
	 editor:"TextArea"
	},
	"status":BView.cfg_status,
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最近修改',
	  dcfg:{
		readOnly:true
	 	}  
	 }
	}
 },
"dao.hb.NBase":{
	req:{
		"pss" : [["id","vid", "itype","language","title","uid","statusPublish","statusComment","dtCreate","dtModify","tnid","pnid","ord"]],
		"cns" : ["dao.hb.NBase"],
		"hql" : "from NBase"
	},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序'],
		hide: ["remark"]
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"vid":{
	 display:"当前版本"
	},
	"itype":{
	 display:"类型",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['餐馆', 1],['图片',2],['分类',3],['菜品',4]])
	},
	"language":{
	 display:"语种",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_LANG_","id")
	},	
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"statusPublish":{
	 display:"发布状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['隐藏', 0],['超稿',1],['发布',2]])
	},
	"statusComment":{
	 display:"评论状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['禁止', 0],['允许',1]])
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最后修改',
	  dcfg:{
		readOnly:true
	 	}
	},
	"tnid":{
	  display:'翻译节点'
	},
	"pnid":{
	  display:'父节点'
	},
	"ord":{
	  display:'顺序'
	}
	},
	child_views : [{
  	title:"翻译",
  	vn:"dao.hb.NBase",
	func_filter: function(robj, ui) {
		var hql = " from NBase where  tnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["tnid"]=robj.items.map['id'];
	}
  },{
  	title:"菜品分类",
  	vn:"dao.hb.NSort",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
  	func_view:function(vw,robj){
  		vw.cfg_grid.btns=['增加','删除','打开','保存','检索','刷新','排序',BView.btns["copyto"],BView.btns["json_cls"]];
  		vw.robj = robj;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NSort where  nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"相关图片",
  	vn:"dao.hb.NBase",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1 || robj.items.map['itype']==4;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NBase where itype=2 and pnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pnid"]=robj.items.map['id'];
		objs[0].items.map["itype"]=2;
	}
  },{
  	title:"相关菜品",
  	vn:"dao.hb.NBase",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
  	func_view:function(vw,robj){
  		vw.cfg_grid.btns=['增加','删除','打开','保存','检索','刷新','排序',BView.btns["copyto"]];
  	},
	func_filter: function(robj, ui) {
		var hql = " from NBase where itype=4 and pnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pnid"]=robj.items.map['id'];
		objs[0].items.map["itype"]=4;
	}
  },{
  	title:"餐馆历史版本",
  	vn:"dao.hb.NRestaurant",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NRestaurant where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"菜品历史版本",
  	vn:"dao.hb.NMenu",
  	func_limit:function(robj){
  		return robj.items.map['itype']==4;
  	},
  	func_view:function(vw,robj){
   		vw.cfg_prop["stype"].cfg .loader={
            	autoLoad: true,
               // url:'class_mnu.json',
              	url:Bat.WC +'servlet/JSonBaseServlet?nid='+robj.items.map['pnid']
            };
  	},
	func_filter: function(robj, ui) {
		var hql = " from NMenu where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"图片历史版本",
  	vn:"dao.hb.NImage",
  	func_limit:function(robj){
  		return robj.items.map['itype']==2;
  	},  	
	func_filter: function(robj, ui) {
		var hql = " from NImage where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  }]
 },

 "dao.hb.OLocation":{
	req:{
		"pss" : [["id","uid","dtCreate","dtModify","remark","status", "name", "longitude","latitude","bw","bn","be","bs"]],
		"cns" : ["dao.hb.OLocation"],
		"hql" : "from OLocation"
	},
	func_title: function(o){ return o.items.map['name']+'详细信息'; },
	cfg_detail:{
	 btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid","dtCreate","dtModify","status", "name", "longitude","latitude"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','打开','保存','检索','刷新','排序',{
	   		text: '地图',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/world.png',
			handler : function(btn){
				BView.openTabpanel("map","城区图","../ol/bm.html");
			}}],
		hide: ["remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"name":{
	 display:"名称"
	},
	"code":{
	 display:"编号"
	},
	"longitude":{
	 display:"X坐标"
	},"latitude":{
	 display:"Y坐标"
	},
	"status":BView.cfg_status,
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}	

	
  },child_views : [{
  	title:"相关设备",
  	vn:"dao.hb.ODevice",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODevice where sid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["sid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OLocation";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }],
  rel_views:[{
  	title:"关联附件",
  	vt:{
  		vn:"dao.hb.ODevice",
  		title:"已关联附件"
  	},
  	vs:{
  		vn:"dao.hb.UUser",
  		title:"可选附件"
  	}
  }]
 },
 "dao.hb.ODevice":{
 	cn:'设备',
 	func_item:function(vw,robj){
 		console.log(robj);
 	},
	req:{
		"pss" : [["id","mid","sid","dtCreate","dtModify","remark","status","sno","name","ipAddr"]],
		"cns" : ["dao.hb.ODevice"],
		"hql" : "from ODevice order by id"
	},
	cfg_detail:{
	btns:["保存","游标"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","mid","sid","status","sno","name","ipAddr"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["dtCreate","dtModify","remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存',{
			text : '操作',
			cls : 'x-btn-text-icon',
			icon : '../bat/icons/refresh.png',
			menu : {
                items: [{
                	text:'设备配置',
                	handler:function(b,e){
						BView.openTabpanel("config","设备配置","config.jpg");
               	},scope:this
                },{
                	text:'画面线框',
                	handler:function(b,e){
                		BView.openTabpanel("poly","画面线框","poly.jpg");
                	},scope:this
                },{
                	text:'历史数据',
                	handler:function(b,e){
                		BView.openTabpanel("pasttime","历史数据","show.jpg");
                	},scope:this
                }]
			}
		},'检索','刷新','排序'],
		hide: ["dtCreate","dtModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("select id,name from ODeviceType order by id","id")
	},
	"sid":{
	 display:"位置序号"
	},
	"sno":{
	 display:"设备编号"
	},
	"name":{
	 display:"设备名称" 
	},
	"ipAddr":{
	 display:"ip地址"
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0], ['备用', 2]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"HtmlEditor"
	}	
  }
 },
 "dao.hb.ODeviceType":{
	req:{
		"pss" : [["id","dtCreate","dtModify","remark","name","smode","stype","attrLabel","attrTip","handle","handlePara","status"]],
		"cns" : ["dao.hb.ODeviceType"],
		"hql" : "from ODeviceType"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","dtCreate","dtModify","name","smode","stype","attrLabel","attrTip","handle","handlePara"]
		}]
		},{
		title : "handle参数",
		fset : [{
			legend : "",
			props :["handlePara"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
		}
	]},
	cfg_grid:{
		hide: ["remark","handlePara"]
	},
	cfg_prop:{
	"id":{
	  display:'设备类型id',
	  cfg:{
	  	readOnly:true
	  }
	},
	"attrLabel":{
	 display:"实时显示属性"	 
	},
	"attrTip":{
	 display:"tip显示属性"
	},
	"name":{
	 display:"名称"	 
	},
	"stype":{
	 display:"分类"
	},
	"handle":{
	 display:"handle处理",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['THEnum', "THEnum"],['THXXX', "THXXX"]])
	},
	"smode":{
	 display:"采集方式",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['Robot', "Robot"],['Cam', "Cam"],['CAM_Robot', "CAM_Robot"],['GTI_Robot', "GTI_Robot"],['Snmp', "Snmp"],['Serial','Serial'],['Local','Local'],['Virtual','Virtual']])
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0], ['备用', 2]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"trapDesc":{
	  display:'trap描述',
	  editor:"TextArea"
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}	
  },child_views : [{
  	title:"相关菜单项",
  	vn:"dao.hb.ODeviceManage",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODeviceManage where mid=" + (robj.items.map['id'] || 0);	
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["mid"]=robj.items.map['id'];
	}
  },{
  	title:"相关属性",
  	vn:"dao.hb.ODeviceItem",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODeviceItem where mid=" + (robj.items.map['id'] || 0);	
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["mid"]=robj.items.map['id'];
	}
  }
  ]
 },

 "dao.hb.ODeviceManage":{
	req:{
		"pss" : [["id","mid","mode","uri","name","mnuOrd"]],
		"cns" : ["dao.hb.ODeviceManage"],
		"hql" : "from ODeviceManage"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","mid","mode","uri","name","mnuOrd"]
		}]
		}
		]},
	cfg_grid:{
		//hide: ["id","mid","mode","uri","name","mnuOrd"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型序号"	 
	}
  }
  },
 
 "dao.hb.ODeviceItem":{
	req:{
		"pss" : [["id","mid", "name","dispalyname", "style","styleParam","valtype","ordernum","vaildconditon","rule","coefficient","unit","oid","tmCreate","tmModify","remark","spanVal","spanQuery"]],
		"cns" : ["dao.hb.ODeviceItem"],
		"hql" : "from ODeviceItem"
	},
	cfg_detail:{
		btns:["保存"],
		tabs:[{
		title : "配置属性",
		fset : [{
			legend : "",
			props :["id","mid", "name","dispalyname","coefficient","unit","oid"]
		}]
		},{
		title : "状态属性",
		fset : [{
			legend : "",
			props :["spanVal","spanQuery"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]}]		
	},	
	cfg_grid:{
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'id',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型id"
	},
	"name":{
	 display:"参数名称"
	},
	"dispalyname":{
	 display:"参数显示名称"
	}, 
	"style":{
	 display:"参数显示类型",
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'文本框':'文本框','下拉框':'下拉框','无':'无'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([['文本框', "文本框"],['下拉框','下拉框'],['无','无']])
	},
	"styleParam":{
	 display:"类型补充值"
	},
	"valtype":{
	 display:"参数值类型",
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'Integer':'Integer','String':'String'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([['Integer', "Integer"],['String','String']])
	},
	"ordernum":{
	 display:"显示顺序"
	},
	"vaildconditon":{
	 display:"参数有效条件"
	},
	"rule":{
	 display:"参数转换规则"
	},
	"coefficient":{
	 display:"系数"
	},
	"unit":{
	 display:"计量单位"
	},
	"oid":{
	 display:"oid"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  }
 },
 "dao.hb.OAttachment":{
 	cn:'附件',
 	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OStation";
	},
	req:{
		"pss" : [["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify","remark"]],
		"cns" : ["dao.hb.OAttachment"],
		"hql" : "from OAttachment"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序',{
	   		text: '绑定',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/connect.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
			  var its = sels[0].obj.items.map;
			  var prs;
			  //选中的是绑定js附件
			  if(its.entityName=="dao.hb.OAttachment"){
			  	prs = "pid="+its.entityId+"&jid="+its.id;
			  	if(its.path){
			  		prs+="&jurl="+its.path;
			  	}
			  }else{//选定底图附件
			  	prs = "pid="+its.id;
			  	if(its.path){
			  		prs+="&purl="+its.path;
			  	}
			  }
			  var jwin = window.open("../ol/bind_edit.html?"+prs, "bind_edit");
			}},{
	   		text: '显示',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/monitor.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
			  var its = sels[0].obj.items.map;
			  var prs;
			  //选中的是绑定js附件
			  if(its.entityName=="dao.hb.OAttachment"){
			  	prs = "pid="+its.entityId+"&jid="+its.id;
			  	if(its.path){
			  		prs+="&jurl="+its.path;
			  	}
			  }else{//选定底图附件
			  	prs = "pid="+its.id;
			  	if(its.path){
			  		prs+="&purl="+its.path;
			  	}
			  }
			  var jwin = window.open("../ol/bind_view.html?"+prs, "bind_view");
			}}],
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0]])
	},
	"entityName":{
	 display:'数据库表',
	 	  cfg:{
	  	readOnly:true
	 },
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"entityId":{
	 display:"记录编号"
	},
	"name":{
	 display:"附件名"
	},
	"stype":{
	 display:"附件分类"
	},
	"size":{
	 display:"文件长度"
	},
	"path":{
		display:'附件路径',
		editor:"FileField"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  },child_views : [{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OAttachment";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }]
 },
 
  "dao.hb.LSync":{
	req:{
		"pss" : [["id","uid","dtCreate", "remark","entity","entityId","oper"],["name","avatar"]],
		"cns" : ["dao.hb.LSync","dao.hb.UUser"],
		"hql" : "from LSync A,UUser B where A.uid = B.id order by A.id desc"
	},
	cfg_detail:{	
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["A.id","A.dtCreate", "B.avatar","A.remark","A.entity","A.entityId"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["A.remark"]
		}]
	}]},
	//cfg_prop_all:{cfg:{readOnly:true}},
	cfg_grid:{
		propNames:["A.id","B.avatar","A.dtCreate","A.oper","A.entity","A.entityId","A.remark"],
		btns:['打开','检索','刷新','排序','图表']
	},
	cfg_prop:{
	"A.id":{
	  display:'序号'
	},
	"A.entity":{
	 display:'数据类',
	 width:150,
	 //cfg:{readOnly:true},
	  editor:'DisplayField',
	  	renderer : function(itxt,r,col,l) {	
	  		var bv = BView.viewMap[itxt];
	  		return bv?bv.cn||itxt:itxt;
		}
	},
	"A.entityId":{
	 display:"数据项",
	  	cfg:{readOnly:true},
	  	editor:'DisplayField',
	  	renderer : function(itxt,r,col,l) {	
	  		var its = r.record?r.record.data:r.item||{};
	  		return "<a href='' onclick='layout.renderDetailByKey(\""
	  			+its['A.entity']+"\",false,"+itxt+");return false;'>"+ itxt+"</a>";
		}
	},
	"A.oper":{
	  display:"动作",
	  cfg:{readOnly:true},
	 renderer:function(itxt,r,col,l){
	 	var dtxt = {						
		'65':'增加',	
		'82':'删除',
		'85':'修改'
		};
		return dtxt[itxt];
	 }
	},
	"A.dtCreate":{
	  editor:"DateField",
	  display:'时间',
	  cfg:{readOnly:true},
	  width:150
	},"A.remark":{
	  display:'内容',
	  editor:"TextArea",
	  width:250
	 },"B.name":{
	  display:'用户名',
	  hidden:true
	 },"B.avatar":{
	  display:'用户头像',
	  	cfg:{readOnly:true},
	  	editor:'DisplayField',
	  	renderer : function(itxt,r,col,l) {	
	  		var src=itxt?"/ipcm/servlet/fu?f="+itxt:'icons/avatar.png';
	  		var its = r.record?r.record.data:r.item||{};
	  		return "<img style='cursor:hand;' src='"+src+"' title='"+ its['B.name']
	  		+"' onclick='layout.renderDetailByKey(\"dao.hb.UUser\",false,"+its['A.uid']+");return false;'/>";
		}
	 }
  }
 },
 
 "dao.hb.LAlarm":{
	req:{
		"pss" : [["id","dtCreate", "oid","remark","propName","propVal", "level"],[],["name"]],
		"cns" : ["dao.hb.LAlarm","dao.hb.ODevice","dao.hb.OLocation"],
		"hql" : "from LAlarm A,ODevice B,OLocation C where A.oid = B.id and B.sid=C.id"
	},
	cfg_detail:{	
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["A.id","A.dtCreate","C.name", "A.oid","A.remark","A.propName","A.propVal", "A.level"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	//cfg_prop_all:{cfg:{readOnly:true}},
	cfg_grid:{
		btns:['增加','保存','检索','刷新','排序','图表'//,BView.getBtnForExcel({id:"id",obj:"dao.hb.LAlarm",item:"[filter,single,currentPage,all]"})
		],
		hide: ["classname"]
	},
	cfg_prop:{
	"A.id":{
	  display:'序号'
	},
	"A.classname":{
	 display:'状态类名'
	},
	"A.oid":{
	 display:"设备ID"
	},
	"C.name":{
	 display:"位置"
	},
	"A.propName":{
	 display:"属性名"
	},
	"A.propVal":{
	 display:"属性值"
	},
	"A.level":{
	 display:"报警级别"
	},
	"A.dtCreate":{
	  editor:"DateField",
	  display:'报警时间',
	  width:150
	},"A.remark":{
	  display:'内容',
	  editor:"TextArea",
	  width:250
	 }
  }
 },
 "dao.hb.UUser":{
 	cn:'用户',
  	handles:{'before_setobj_detail':function(ui,editors,obj){
  		//editors['dtResolved'][0].setReadOnly(false);
  		if(layout.uid==obj.items.map['uid'])
  			BView.setEnableFields(editors,['id','avatar'],false);
  		else
  			BView.setEnableFields(editors,['avatar'],true);
     }
  	},
	req:{
		"pss" : [["id", "userId","gid","uid","pwd","name","email","lang","tel","phone","dpt","qq","status","online","dtLogin","dtLogout","dtCreate","dtModify","remark","handle","avatar"]],
		"cns" : ["dao.hb.UUser"],
		"hql" : "from UUser"
	},
	cfg_detail:{
		btns:["保存"],
		tabs:[
		{
	//layout test
	title:'column layout',
	items:[{
        layout:'column',
        border:false,
        items:[{
            columnWidth:.5,
            layout: 'form',
            border:false,
            props :["id","userId"]

        },{
            columnWidth:.5,
            layout: 'form',
            border:false,
            props :["gid","pwd"]

        },{
            columnWidth:1,
            layout: 'form',
            border:false,
            props :["dtCreate"]

        }]	            
	},{
		xtype:'tabpanel',
		defaults : {
			bodyStyle : 'padding:10px'
		},
        plain:true,
        activeTab: 0,
        height:235,
        tabs:[
		{title:'tab1',props :["id","userId"]},
		{title:'tab2',props :["gid","pwd"]}]
	}]},//layout test end
		{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","avatar","userId","gid","pwd","dpt","name","lang","status","online","dtLogin","dtLogout","dtCreate","dtModify","handle"]
		}]
		},{
		title : "联系方式",
		fset : [{
			legend : "",
			props :["email","tel","phone","qq"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:[{
	   		text: '留言',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/comments.png',
			handler : function(btn){
			  var ui=btn.ui;
			  var sels=BView.getSels(btn);
			  var val_to,name_to;
			  if(!sels || sels.length==0){
			  	val_to=null;
			  	name_to="全部";
			  }
			  else{
			  	val_to = [];
			  	name_to= "";
			  	for(var i=0;i<sels.length; i++){
			  		var im = sels[i].obj.items.map;
			  		val_to[val_to.length]=im["id"];
			  		if(i==0)
			  			name_to+=im["name"];
			  		else 
			  			name_to+=";"+im["name"];
			  	}
			  }
			  BView.sendMessage("SendTo","发送留言到["+name_to+"]",{title:"",content:"",offline:true},{to:val_to});
		    }
		   },'检索','刷新','排序'],
		hide: ["pwd","tmCreate","tmModify","remark","handle","uid","lang","tel","phone","msn","qq"]
	},
	cfg_prop:{
	"gid":{
	 display:'用户组',
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("select id,name from UGroup order by id","id")
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},	
	"avatar":{
	  display:'头像',
	  editor:"FileField"
	},	
	"userId":{
	  display:'用户名',
	  cfg:{readOnly:true,readOnlyCls:'form_editor_readonly'}
	},	
	"dpt":{
	  display:'部门'
	},	
	"pwd":{
	  display:'用户密码',
	  cfg:{
	  	inputType:'password'
	  }
	},	
	"name":{
	  display:'真实姓名'
	},
	"lang":{
	  display:"语种",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_LANG_","id")
	},
	"tel":{
	  display:'电话'
	},	
	"name":{
	  display:'真实姓名'
	},	
	"online":{
	  display:'在线吗',
	  cfg:{
	  	readOnly:true
	  },
	  renderer : function(itxt,r,col,l) {	
	  	if(!col)
	  		return itxt;
	  	if(itxt==1)
	  		return "<img src=\"icons/status_online.png\"/>";
	  	else
	  		return "<img src=\"icons/status_offline.png\"/>";
	  }
	},	
	"status"://BView.cfg_status,
	{
		display:'状态',
		editor:'Checkbox'
	},
	"remark":{
	  display:'备注',
	  editor:"TextArea"
	},	
	"handle":{
	  display:'登录令牌',
	  cfg:{
	  	readOnly:true
	  }
	},	
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtLogin":{
	  editor:"DateField",
	  display:'最近登入',
	  dcfg:{
		readOnly:true
	 }
	},
	"dtLogout":{
	  editor:"DateField",
	  display:'最近退出',
	  dcfg:{
		readOnly:true
	 }
	}			
  }
 },
 "dao.hb.UGroup":{
	req:{
		"pss" : [["id", "name","dtCreate","dtModify","remark"]],
		"cns" : ["dao.hb.UGroup"],
		"hql" : "from UGroup"
	},
	cfg_detail:{
		 btns:["保存"]
	},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序'],
		hide: ["remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"name":{display : '命名'},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}

  },child_views : [{
  	title:"相关权限",
  	vn:"dao.hb.UGrant",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from UGrant where gid=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["gid"]=robj.items.map['id'];
	}
  }]
 },

 "dao.hb.UGrant":{
	req:{
		"pss" : [["id", "gid","pmMenu","pmEntity","pmOper","dtCreate","dtModify","remark"]],
		"cns" : ["dao.hb.UGrant"],
		"hql" : "from UGrant"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id", "gid","pmMenu","pmEntity","pmOper","dtCreate","dtModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"gid":{
	 display:'用户组',
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("select id,name from UGroup order by id","id")
	},
	"pmMenu":{
	 display:'功能菜单',
	 editor : 'ComboBox'//,
	 //cfg :BView.func_cfg_combo("LIST_ENTITYS","id")
	},
	"pmEntity":{
	 display:'数据库表',
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"pmOper":{
	 	display:'操作',
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'1':'查看',	
			'2':'修改',
			'3':'增删'
			};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([["查看", 1], [ "修改",2], ["增删",3 ]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
	
  }
 },

 "dao.hb.MMessage":{
	req:{
		"pss" : [["id", "uid","mid","online","stype","sendTo","title","content","tmCreate","tmModify","tmReply","rname","status"]],
		"cns" : ["dao.hb.MMessage"],
		"hql" : "from MMessage order by id desc"
	},
	cfg_prop_all:{cfg:{readOnly:true}},
	cfg_detail:{tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id", "uid","online","stype","sendTo","title","tmCreate","tmModify","status"]
		}]
		},{
		title : "留言内容",
		fset : [{
			legend : "",
			props :["content"]
		}]
		}]},
	cfg_grid:{
		btns:['打开',{
	   		text: '用户组留言',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/comments.png',
			handler : function(btn){
			  BView.sendMessage("SendToGroup","发送留言到用户组",{sendToGroup:"",title:"",content:""},{offline:"on"});
			}
        } ,'检索','刷新','排序'],
        btn_revise: function(b){ if(b.text=='编辑') b.text='查看' },
		hide: ["content","tmCreate","tmModify"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"uid":{
	 display:'用户'
	},
	"mid":{
	 display:'主留言id'
	},
	"title":{
	 display:'留言题名'
	},
	"content":{
	 display:'留言内容',
	 editor:"TextArea"
	},
	"pmMenu":{
	 display:'功能菜单',
	 editor : 'ComboBox'//,
	 //cfg :BView.func_cfg_combo("LIST_ENTITYS","id")
	},
	"online":{
	 display:'在线消息'
	},
	"sendTo":{
	 display:'目标用户(组)'
	},
	"stype":{
	 	display:'类型',
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'1':'系统通知',	
			'2':'业务沟通',
			'3':'问候'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([["系统通知", 1], [ "业务沟通",2], ["问候",3 ]])
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间'
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间'
	},"tmReply":{
		editor:"DateField",
	  	display:'回复时间'
	},"rname":{
	  display:'回复人'
	},"status":{
	  display:'状态'
	}
	
  },child_views : [{
  	title:"相关回复",
  	vn:"dao.hb.MMessage",
	func_filter: function(robj, ui) {
		var hql = " from MMessage where mid=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	} }]
 },
  "dao.hb.MInbox":{
  	handles:{'before_save':function(ui){
  		//将如果查看时间为空,设置为已查看
    		for(var i=0,len=ui.objs.length;i<len;i++){
    			var cur = ui.objs[i];
    			if(cur.action=='O'&& cur.items.map["A.tmCheck"]==null){
    				cur.action='U';
    			}
    		}
    	}
    },
	req:{
		"pss" : [["id", "mid","uid","tmCheck"],["id","uname","stype","title","tmCreate","content"]],
		"cns" : ["dao.hb.MInbox","dao.hb.MMessage"],
		"hql" : "from MInbox A, MMessage B where A.mid=B.id order by A.id desc"
	},
	cfg_detail:{
	 btns:[{
	   		text: '回复',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_go.png',
			handler : function(btn){
			 var im = this.obj_detail.items.map;
			 var uiDetail=this;
			 BView.sendMessage("Re","回复留言["+im["A.mid"]+"]",{title:"Re:"+im["B.title"],content:""},{mid:im["A.mid"],offline:"on",to:[im["B.id"]]},
			 	function(){
			 		var ap = layout.tabPanel.getActiveTab();
		 			layout.tabPanel.remove(ap,false);
			 	});
			}},{
	   		text: '转发',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_link.png',
			handler : function(btn){
			 var im = this.obj_detail.items.map;
			 BView.sendMessage("forward","转发留言["+im["A.mid"]+"]",{sendToGroup:"",title:"Fw:"+im["B.title"],content:im["B.content"]},{offline:"on"},
			 function(){
			 		var ap = layout.tabPanel.getActiveTab();
		 			layout.tabPanel.remove(ap,false);
			 });
			}}],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["A.id", "A.mid","A.uid","A.tmCheck","B.uname","B.stype","B.title","B.tmCreate","B.content"]
		}]
		},{
		title : "留言内容",
		fset : [{
			legend : "",
			props :["B.content"]
		}]
		}]},
	cfg_prop_all:{cfg:{readOnly:true}},
	cfg_grid:{
		btns:['打开',{
	   		text: '回复',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_go.png',
			handler : function(btn){
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return false;
			  }
			  var im = sels[0].obj.items.map;
			  BView.sendMessage("Re","回复留言["+im["A.mid"]+"]",{title:"Re:"+im["B.title"],content:""},{mid:im["A.mid"],offline:"on",to:[im["B.id"]]});
			}},{
	   		text: '转发',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_link.png',
			handler : function(btn){
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return false;
			  }
			  var im = sels[0].obj.items.map;
			  BView.sendMessage("forward","转发留言["+im["A.mid"]+"]",{sendToGroup:"",title:"Fw:"+im["B.title"],content:im["B.content"]},{offline:"on"});
			}},'检索','刷新','排序'],
		btn_revise: function(b){ if(b.text=='编辑') b.text='查看' },
		hide: ["B.content"]
	},
	cfg_prop:{
	"A.id":{
	  display:'序号'
	},
	"A.mid":{
	  display:'留言序号'
	},
	"A.uid":{
	  display:'目标用户'
	},
	"A.tmCheck":{
	  display:'查看时间',
	  editor:"DateField"
	},
	"B.id":{
	  display:'留言序号'
	},
	"B.uname":{
	  display:'留言者'
	},
	"B.stype":{
	  display:'留言类型'
	},
	"B.title":{
	  display:'留言题名'
	},
	"B.content":{
	  display:'留言内容',
	  editor:"TextArea"
	},
	"B.tmCreate":{
	  display:'留言时间',
	  editor:"DateField"
	}
  },child_views : [{
  	title:"相关回复",
  	vn:"dao.hb.MMessage",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from MMessage where mid=" + (robj.items.map['B.id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		//objs[0].items.map["mid"]=robj.items.map['id'];
	}
  }]
 }  ,
 "dao.hb.Bm":{
		req:{
			"pss" : [["id","bh","bhYh","bhFlh","mc","mcYmc","lbCpzl","lbWwlb","lbCplb","lbGnlb","mz","dq","ysd","ndSd","ndMs","zd","zdMs","cc","zl","slCtsl","slCtsldw","slSjsl"
			          ,"slSjsldw","jb","msJs","msZzgy","msLcjg","msYtyf","msJdqk","msBz","msFj","wcCd","wcMs","bczt","cffw","glRgrq","glDbr","glDbrq","glDbshr","glDbshrq","zx","zxRq","zxYy","UZxr","UZxsh","dtZxsh"]],
			"cns" : ["dao.hb.Bm"],
			"hql" : "from Bm order by id desc",
			"close":"true"
		},
		cfg_prop_all:{cfg:{readOnly:true}},
		cfg_detail:{tabs:[/**{
			title : "基本信息",
			fset : [{
				legend : "",
				props :[]
			},{
				legend:"",
				props:[]
			}]
			},**/	{
				//layout test
				title:'基本信息',
				items:[{
			        layout:'column',
			        border:false,
			        items:[{
			            columnWidth:.3,
			            layout: 'form',
			            border:false,
			            props :["id","bh","bhYh","bhFlh","mc","mcYmc","lbCpzl","lbWwlb","lbCplb","lbGnlb","mz","dq"]

			        },{
			            columnWidth:.3,
			            layout: 'form',
			            border:false,
			            props :["ysd","ndSd","ndMs","zd","zdMs","cc","zl","slCtsl","slCtsldw","slSjsl"]

			        }]	            
				},{
					xtype:'tabpanel',
					defaults : {
						bodyStyle : 'padding:10px'
					},
			        plain:true,
			        activeTab: 0,
			        height:235,
			        tabs:[
					{title:'tab1',props :["slSjsldw","jb","msJs","msZzgy","msLcjg","msYtyf","msJdqk","msBz"]},
					{title:'tab2',props :["msFj","wcCd","wcMs","bczt","cffw","glRgrq","glDbr","glDbrq","glDbshr","glDbshrq","zx","zxRq","zxYy","UZxr","UZxsh","dtZxsh"]}]
				}]}]},
		cfg_grid:{
			btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
		},
		child_views : [{
		  	title:"完残指标",
		  	vn:"dao.hb.BmWc",
			func_filter: function(robj, ui) {
				var cn = robj.cns[0];
				var hql = " from BmWc where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
				ui.setHQL(hql);
			},
			func_setdefault:function(robj,objs){
				objs[0].items.map["idBm"]=robj.items.map['id'];
			}
		  },{
			  	title:"方位指标",
			  	vn:"dao.hb.BmFw",
				func_filter: function(robj, ui) {
					var cn = robj.cns[0];
					var hql = " from BmFw where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
					ui.setHQL(hql);
				},
				func_setdefault:function(robj,objs){
					objs[0].items.map["idBm"]=robj.items.map['id'];
				}
			  },/**{
				  	title:"动态信息",
				  	vn:"dao.hb.BmCrkCp",
					func_filter: function(robj, ui) {
						var cn = robj.cns[0];
						var hql = " from BmCrkCp where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
						ui.setHQL(hql);
					},
					func_setdefault:function(robj,objs){
						objs[0].items.map["idBm"]=robj.items.map['id'];
					}
				  }**/
			  {
				  	title:"修复信息",
				  	vn:"dao.hb.BmXf",
					func_filter: function(robj, ui) {
						var cn = robj.cns[0];
						var hql = " from BmXf where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
						ui.setHQL(hql);
					},
					func_setdefault:function(robj,objs){
						objs[0].items.map["idBm"]=robj.items.map['id'];
					}
				  },{
					  	title:"事故信息",
					  	vn:"dao.hb.BmSg",
						func_filter: function(robj, ui) {
							var cn = robj.cns[0];
							var hql = " from BmSg where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
							ui.setHQL(hql);
						},
						func_setdefault:function(robj,objs){
							objs[0].items.map["idBm"]=robj.items.map['id'];
						}
					  }/*,{
						  	title:"鉴定信息",
						  	vn:"dao.hb.BmJd",
							func_filter: function(robj, ui) {
								var cn = robj.cns[0];
								var hql = " from BmJd where idBm=" + (robj.items.map['id'] || 0)+" order by id";		
								ui.setHQL(hql);
							},
							func_setdefault:function(robj,objs){
								objs[0].items.map["idBm"]=robj.items.map['id'];
							}
						  },{
							  	title:"资源信息",
							  	vn:"",
								func_filter: function(robj, ui) {
									
								},
								func_setdefault:function(robj,objs){
								}
							  }*/
			  ],
		cfg_prop:{
		"id":{
		  display:'序号',
		  cfg:{
		  	readOnly:true
		  }
		},
		"bh":{
		 display:'藏品编号'
		},
		"bhYh":{
		 display:'藏品编号_原号'
		},
		"bhFlh":{
			display:"藏品编号_分类号"
		},
		"mc":{
			display:"藏品名称"
		},
		"mcYmc":{
			display:"原名称"
		},
		"lbCpzl":{
			display:"藏品类别_藏品种类"
		},
		"lbWwlb":{
			display:"藏品类别_文物类别"
		},
		"lbCplb":{
			display:"藏品类别_藏品类别"
		},
		"lbGnlb":{
			display:"藏品类别_功能类别"
		},
		"mz":{
			display:"藏品所属民族"
		},
		"dq":{
			display:"藏品所属地区"
		},
		"ysd":{
			display:"原属地"
		},
		"ndSd":{
			display:"年代_时代"
		},
		"ndMs":{
			display:"年代的文字描述"
		},
		"zd":{
			display:"质地"
		},
		"zdMs":{
			display:"质地描述"
		},
		"cc":{
			display:"藏品的具体尺寸、描述性字段"
		},
		"zl":{
			display:"藏品的具体重量、面属性字段"
		},
		"slCtsl":{
			display:"传统数量"
		},
		"slCtsldw":{
			display:"传统数量单位"
		},
		"slSjsl":{
			display:""
		},
        "slSjsldw":{
        	display:"实际数量单位"
        },
        "jb":{
        	display:"藏品级别"
        },
        "msJs":{
        	display:"描述说明_简述"
        },
        "msZzgy":{
        	display:"描述说明_制作工艺"
        },
        "msLcjg":{
        	display:"描述说明_流传经过"
        },
        "msYtyf":{
        	display:"描述说明_用途用法"
        },
        "msJdqk":{
        	display:"描述说明_鉴定情况"
        },
        "msBz":{
        	display:"描述说明_备注"
        },
        "msFj":{
        	display:"描述说明_附件"
        },
        "wcCd":{
        	display:"完残程度"
        },
        "wcMs":{
        	display:"完残描述"
        },
        "bczt":{
        	display:"保存状态"
        },
        "cffw":{
        	display:"存放方位"
        },
        "glRgrq":{
        	display:"管理信息_入馆日期"
        },
        "glDbr":{
        	display:"管理信息_登编人"
        },
        "glDbrq":{
        	display:"管理信息_登编日期"
        },
        "glDbshr":{
        	display:"管理信息_审核人"
        },
        "glDbshrq":{
        	display:"管理信息_登编审核日期"
        },
        "zx":{
        	display:"注销信息_是否注销"
        },
        "zxRq":{
        	display:"注销日期"
        },
        "zxYy":{
        	display:"注销原因"
        },
        "UZxr":{
        	display:"注销人"
        },
        "UZxsh":{
        	display:"注销审核人"
        },
        "dtZxsh":{
        	display:"注销审核日期"
        }
		
	  }
	 },
	 "dao.hb.BmWc":{
			req:{
				"pss" : [["id","idBm","cd","ms","yy","bz","ULrr","lrsj","shr","shsj","lrlx"]],
				"cns" : ["dao.hb.BmWc"],
				"hql" : "from BmWc order by id desc",
				"close":"true"
				
			},
			cfg_prop_all:{cfg:{readOnly:true}},
			cfg_detail:{tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["id","idBm","cd","ms","yy","bz","ULrr","lrsj","shr","shsj","lrlx"]
				}]
				}]},
			cfg_grid:{
				btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
			},
			cfg_prop:{
			"id":{
				display:"编号"
			},
			"idBm":{
				display:"藏品编目序号"
			},
			"cd":{
				display:"完残程度"
			},
			"ms":{
				display:"完残描述"
			},
			"yy":{
				display:""
			},
			"bz":{
				display:"备注"
			},
			"ULrr":{
				display:"录入人"
			},
			"lrsj":{
				display:"录入时间"
			},
			"shr":{
				display:"审核人"
			},
			"shsj":{
				display:"审核时间"
			},
			"lrlx":{
				display:"完残录入类型"
			}
			}
		 },
 "dao.hb.BmFw":{
		req:{
			"pss" : [["id","idBm","kf","fw","rkdsr","rkrq","lrr","lrsj","shr","shsj"]],
			"cns" : ["dao.hb.BmFw"],
			"hql" : "from BmFw order by id desc",
			"close":"true"
			
		},
		cfg_prop_all:{cfg:{readOnly:true}},
		cfg_detail:{tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["id","idBm","kf","fw","rkdsr","rkrq","lrr","lrsj","shr","shsj"]
			}]
			}]},
		cfg_grid:{
			btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
		},
		cfg_prop:{
		"id":{
			display:"编号"
		},
		"idBm":{
			display:"藏品编目序号"
		},
		"kf":{
			display:"库房"
		},
		"fw":{
			display:"方位描述"
		},
		"rkdsr":{
			display:"入库点收入"
		},
		"rkrq":{
			display:"入库日期"
		},
		"lrr":{
			display:"录入人"
		},
		"lrsj":{
			display:"录入时间"
		},
		"shr":{
			display:"审核人"
		},
		"shsj":{
			display:"审核时间"
		}
		}
	 },
	 "dao.hb.BmCrk":{
			req:{
				"pss" : [["id","djbh","djmc","tylx","tyyy","kssj","jssj","cg","tyr","tybm"]],
				"cns" : ["dao.hb.BmCrk"],
				"hql" : "from BmCrk order by id desc",
				"close":"true"
				
			},
			cfg_prop_all:{cfg:{readOnly:true}},
			cfg_detail:{tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["id","djbh","djmc","tylx","tyyy","kssj","jssj","cg","tyr","tybm"]
				}]
				}]},
			cfg_grid:{
				btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
			},
			cfg_prop:{
			"id":{
				display:"编号"
			},
			"djbh":{
				display:"单据编号"
			},
			"djmc":{
				display:"单据名称"
			},
			"tylx":{
				display:"提用类型"
			},
			"tyyy":{
				display:"提用原因"
			},
			"kssj":{
				display:"预计提用开始时间"
			},
			"jssj":{
				display:"预计提用结束时间"
			},
			"cg":{
				display:"是否出馆"
			},
			"tyr":{
				display:"提用人"
			},
			"tybm":{
				display:"提用部门"
			}
			}
		 },
		 "dao.hb.BmCrkCp":{
				req:{
					"pss" : [["id","idBmCrk","idBm","kf","kffzr","tyr","kfglrCk","cksj","ghdjr","kfglrTk","tksj","bckyy","crkzt"]],
					"cns" : ["dao.hb.BmCrkCp"],
					"hql" : "from BmCrkCp order by id desc",
					"close":"true"
					
				},
				cfg_prop_all:{cfg:{readOnly:true}},
				cfg_detail:{tabs:[{
					title : "基本信息",
					fset : [{
						legend : "",
						props :["id","idBmCrk","idBm","kf","kffzr","tyr","kfglrCk","cksj","ghdjr","kfglrTk","tksj","bckyy","crkzt"]
					}]
					}]},
				cfg_grid:{
					btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
				},
				cfg_prop:{
				"id":{
					display:"编号"
				},
				"idBmCrk":{
					display:"单据序号"
				},
				"idBm":{
					display:"藏品序号"
				},
				"kf":{
					display:"库房"
				},
				"kffzr":{
					display:"库房负责人"
				},
				"tyr":{
					display:"提用人"
				},
				"kfglrCk":{
					display:"出库库房管理人"
				},
				"cksj":{
					display:"出库时间"
				},
				"ghdjr":{
					display:"归还点交人"
				},
				"kfglrTk":{
					display:"退库库房管理员"
				},
				"tksj":{
					display:"退库时间"
				},
				"bckyy":{
					display:"不出库原因"
				},
				"crkzt":{
					display:"出入库状态"
				}
				}
			 },
			 "dao.hb.BmJdCp":{
					req:{
						"pss" : [["id","idBmJd","idBm","jdjg","lsjz","ysjz","jzpg","cy","bz"]],
						"cns" : ["dao.hb.BmJdCp"],
						"hql" : "from BmJdCp order by id desc",
						"close":"true"
						
					},
					cfg_prop_all:{cfg:{readOnly:true}},
					cfg_detail:{tabs:[{
						title : "基本信息",
						fset : [{
							legend : "",
							props :["id","idBmJd","idBm","jdjg","lsjz","ysjz","jzpg","cy","bz"]
						}]
						}]},
					cfg_grid:{
						btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
					},
					cfg_prop:{
					"id":{
						display:"编号"
					},
					"idBmJd":{
						display:"鉴定单据信号"
					},
					"idBm":{
						display:"藏品序号"
					},
					"jdjg":{
						display:"鉴定结果"
					},
					"lsjz":{
						display:"历史价值"
					},
					"ysjz":{
						display:"艺术价值"
					},
					"jzpg":{
						display:"价值评估"
					},
					"cy":{
						display:"存疑"
					},
					"bz":{
						display:"备注"
					}
					}
				 },
				 "dao.hb.BmSg":{
						req:{
							"pss" : [["id","idBm","sgrq","sgr","sgms","clyj","cljg","clyj"]],
							"cns" : ["dao.hb.BmSg"],
							"hql" : "from BmSg order by id desc",
							"close":"true"
							
						},
						cfg_prop_all:{cfg:{readOnly:true}},
						cfg_detail:{tabs:[{
							title : "基本信息",
							fset : [{
								legend : "",
								props :["id","idBm","sgrq","sgr","sgms","clyj","cljg","clyj"]
							}]
							}]},
						cfg_grid:{
							btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
						},
						cfg_prop:{
						"id":{
							display:"编号"
						},
						"idBm":{
							display:"藏品编号"
						},
						"sgrq":{
							display:"事故日期"
						},
						"sgr":{
							display:"事故人"
						},
						"sgms":{
							display:"事故描述"
						},
						"clyj":{
							display:"处理依据"
						},
						"cljg":{
							display:"处理结果"
						},
						"clyj":{
							display:"处理意见"
						}
						}
					 },
					 "dao.hb.BmXf":{
							req:{
								"pss" : [["id","idBm","xflx","xfnr","xfff","xfr","xfrq","xfjg","ysr","ysrq","bz"]],
								"cns" : ["dao.hb.BmXf"],
								"hql" : "from BmXf order by id desc",
								"close":"true"
								
							},
							cfg_prop_all:{cfg:{readOnly:true}},
							cfg_detail:{tabs:[{
								title : "基本信息",
								fset : [{
									legend : "",
									props :["id","idBm","xflx","xfnr","xfff","xfr","xfrq","xfjg","ysr","ysrq","bz"]
								}]
								}]},
							cfg_grid:{
								btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
							},
							cfg_prop:{
							"id":{
								display:"编号"
							},
							"idBm":{
								display:"藏品编号"
							},
							"xflx":{
								display:"修复类型"
							},
							"xfnr":{
								display:"修复内容"
							},
							"xfff":{
								display:"修复方法"
							},
							"xfr":{
								display:"修复人"
							},
							"xfrq":{
								display:"修复日期"
							},
							"xfjg":{
								display:"修复结果"
							},
							"ysr":{
								display:"验收人"
							},
							"ysrq":{
								display:"验收日期"
							},
							"bz":{
								display:"备注"
							}
						 },
						 "dao.hb.BmJdzj":{
								req:{
									"pss" : [["id","xm","dh","yb","dz","email","uid","dtCreate"]],
									"cns" : ["dao.hb.BmJdzj"],
									"hql" : "from BmJdzj order by id desc",
									"close":"true"
									
								},
								cfg_prop_all:{cfg:{readOnly:true}},
								cfg_detail:{tabs:[{
									title : "基本信息",
									fset : [{
										legend : "",
										props :["id","xm","dh","yb","dz","email","uid","dtCreate"]
									}]
									}]},
								cfg_grid:{
									btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
								},
								cfg_prop:{
								"id":{
									display:"编号"
								},
								"xm":{
									display:"姓名"
								},
								"dh":{
									display:"电话"
								},
								"yb":{
									display:"邮政编码"
								},
								"dz":{
									display:"地址"
								},
								"email":{
									display:"邮箱"
								},
								"uid":{
									display:"录入人"
								},
								"dtCreate":{
									display:"建立时间"
								}
								}
							 },
							 "dao.hb.BmJd":{
									req:{
										"pss" : [["id","jdbh","idZj","jdyj","jdrq","jdjg","kzjg","cy","bz","uid"]],
										"cns" : ["dao.hb.BmJd"],
										"hql" : "from BmJd order by id desc",
										"close":"true"
										
									},
									cfg_prop_all:{cfg:{readOnly:true}},
									cfg_detail:{tabs:[{
										title : "基本信息",
										fset : [{
											legend : "",
											props :["id","jdbh","idZj","jdyj","jdrq","jdjg","kzjg","cy","bz","uid"]
										}]
										}]},
									cfg_grid:{
										btns:['增加','删除','保存','打开' ,'检索','刷新','排序']
									},
									cfg_prop:{
									"id":{
										display:"编号"
									},
									"jdbh":{
										display:"鉴定编号"
									},
									"idZj":{
										display:"专家序号"
									},
									"jdyj":{
										display:"鉴定依据"
									},
									"jdrq":{
										display:"鉴定日期"
									},
									"jdjg":{
										display:"鉴定经过"
									},
									"kzjg":{
										display:"考证经过"
									},
									"cy":{
										display:"存疑"
									},
									"bz":{
										display:"备注"
									},
									"uid":{
										display:"录入人"
									}
									}
								 }
					 }
};

//clone view and modify
var pvw = Bat.clone(BView.viewMap['dao.hb.PTask']);
pvw.cfg_grid.btns=['打开','保存'];
pvw.handles=null;
BView.viewMap['dao.hb.PTask1']=pvw;
